﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class web_Controls_CCLD_NTV : System.Web.UI.UserControl
{
    public Common comm = new Common();
    public DataTable dtt_main, dtt_sub;
    public string sql = "", sql_sub = "", sql_where = "", messDate = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        dtt_sub = comm.getDataTable("select banner_path from HeThong_config where id=4 or id=5");
        if (!string.IsNullOrEmpty(dtt_sub.Rows[0][0].ToString()))
        {
            DateTime t1 = DateTime.ParseExact(dtt_sub.Rows[0][0].ToString().Split(';')[0].ToString(), "dd-MM-yyyy", null);
            DateTime t2 = DateTime.ParseExact(dtt_sub.Rows[0][0].ToString().Split(';')[1].ToString(), "dd-MM-yyyy", null);
            sql_where = " and D.ngay_dang_ky BETWEEN '" + t1.ToString("MM-dd-yyyy") + "' AND '" + t2.ToString("MM-dd-yyyy") + "' ";
        }
        if (!string.IsNullOrEmpty(dtt_sub.Rows[1][0].ToString()))
        {
            sql_where += " and D.ma_ho_so IN (select ma_ho_so_tim_viec from SanGiaoDich_nguoi_tim_viec where ma_san='" +
                dtt_sub.Rows[1][0].ToString() + "')";
        }
        sql = "SELECT *,dbo.fcGetDiaChiChiTiet(A.dia_chi) AS tt FROM dbo.ConNguoi_nguoi AS A " +
            " left JOIN dbo.NguoiTimViec_ho_so AS D ON A.ma_nguoi = D.ma_nguoi" +
            " WHERE A.kich_hoat=1"+sql_where;
        dtt_main = comm.getDataTable(sql);
        //Response.Write(sql);
    }
}
